<?php
$link=mysql_connect("localhost","root","") or die("Không thể kết nối đến server");
mysql_select_db("code",$link);
mysql_query("SET character_set_results=utf8",$link);
?>
<?php $this->load->view('admin/inc/header'); ?>
<div id="maincontainer">
    <?php $this->load->view('admin/inc/menu_admin'); ?>
</div><!--end #maincontainer-->
<div class="content_ng">
    <h1><?php echo $title; ?></h1>
    <?php echo $message; ?>
    <form method="post" action="<?php echo $action; ?>">
        <div class="data">
            <table>
                <tr>
                    <td width="30%">ID Môn Học</td>
                    <td><input type="text" name="id" disabled="disable" class="text" value="<?php echo set_value('id'); ?>"/></td>
                    <input type="hidden" name="id" value="<?php echo set_value('id',$this->form_data->id); ?>"/>
                </tr>
                <tr>
                    <td valign="top">Ngành<span style="color:red;">*</span></td>
                    <td>
                    <select name='nganh' id="nganh"">
                        <option value='<?php echo set_value('nganh',$this->form_data->nganh); ?>'></option>
                        <?php
                        $sql ="select * from nganh";
                        $query = mysql_query($sql);
                        while ($data = mysql_fetch_assoc($query)) {
                            echo "<option value='".$data["id"]."'>".$data["ten_nganh"]."</option>";
                        }

                        ?>
                        </td>
                    <?php echo form_error('nganh'); ?>
                </tr>
                <tr>
                    <td valign="top">Tên Môn<span style="color:red;">*</span></td>
                    <td><input type="text" name="ten_mon" class="text" value="<?php echo set_value('ten_mon',$this->form_data->ten_mon); ?>"/>
                        <?php echo form_error('ten_mon'); ?>
                    </td>
                </tr>
                <tr>
                    <td valign="top">Tín Chỉ<span style="color:red;">*</span></td>
                    <td><input type="text" name="tinchi" class="text" value="<?php echo set_value('tinchi',$this->form_data->tinchi); ?>"/>
                        <?php echo form_error('dienthoai'); ?>
                    </td>
                </tr>

                <tr>
                    <td valign="top">Trạng Thái<span style="color:red;">*</span></td>
                    <td>
                        <select name="state">

                            <option value="0">Không Kích Hoạt</option>
                            <option value="1">Kích Hoạt</option>

                        </select>
                            <?php echo form_error('state'); ?>
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td><input type="submit" value="Save"/></td>
                </tr>
            </table>
        </div>
    </form>
    <br />
    <?php echo $link_back; ?>
</div>
<?php $this->load->view('admin/inc/footer'); ?>